var servicesModule = angular.module('app.services');

/**
 * @ngInject
 */
var employeesResource = function($resource, config) {

    var employeesRes = $resource(config.apiUrl + 'employees');

    function getAll(successCallback, errorCallback) {
        employeesRes.query().$promise.then(successCallback, errorCallback);
    }

    function save(employeeModel, successCallback, errorCallback) {
        employeesRes.save(employeeModel).$promise.then(successCallback, errorCallback);
    }

    function remove(employeeModel, successCallback, errorCallback) {
        employeesRes.delete(employeeModel).$promise.then(successCallback, errorCallback);
    }

    return {
        getAll: getAll,
        save: save,
        remove: remove
    };

};

servicesModule.factory('employeesResource', employeesResource);


